﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate;
using NHibernate.Criterion;
using SuperMarketManagement.Entity;

namespace SuperMarketManagement.DAO.NHibernate
{
    public class EmployeeDAO : GenericDAO<Employee, long>
    {
        public EmployeeDAO(ISession session)
            : base(session)
        {
        }

        public Employee GetByUsername(string username)
        {
            return Session
                .CreateCriteria(typeof(Employee))
                .Add(Expression.Eq("Username", username))
                .UniqueResult<Employee>();
        }
    }
}
